package com.xu.security.service;

import org.springframework.stereotype.Service;

/**
 * 权限验证
 *
 *    @PreAuthorize("@ss.hasPermission('test:hello')")
 *    @GetMapping("hello")
 *    public String hello(){return "hello";}
 * @Author: 许乾伟
 * @Date: 2024/12/4 14:04
 */
@Service("ss")
public class PermissionService {
    /**
     * 判断用户是否拥有某个权限
     * @param permission
     * @return
     */
    public boolean hasPermission(String permission) {
        //todo: 待放开逻辑
//        OnlineUser loginUser = SecurityUtils.getLoginUser();
//        List<String> permissions = loginUser.getPermissions();
//        if (permissions.contains(permission)){
//            return true;
//        }
//        return false;
        return true;
    }
}
